import math

def funcos(eps,x):
    sum,i = 0,0
    flag = 1
    while True:
        temp = math.pow(x, i) / math.factorial(i)
        i += 2
        if abs(temp) > eps:
            sum += flag*temp
            flag = -flag
        else:
            break
    return sum

eps, x = input().split()
eps, x = float(eps), float(x)
value = funcos(eps, x)
print("cos({0}) = {1:.4f}".format(x, value))